package com.hx.reflect;

import java.io.InputStream;
import java.util.Properties;

/**
 * @author jxlgcmh
 * @create 2019-05-11 11:07
 */
public class Demo4 {
    public static void main(String[] args) throws Exception {
        Properties pros = new Properties();
        //方式一：相对路径在project下
//		FileInputStream in = new FileInputStream("jdbc.properties");
        //方式二：相对路径在src下
        ClassLoader loader = Demo4.class.getClassLoader();
        InputStream in = loader.getResourceAsStream("jdbc1.properties");
        pros.load(in);
        String jdbcName = pros.getProperty("jdbc.name");
        System.out.println(jdbcName);
    }
}
